using IQIGame.Onigao.Framework;
using System.Collections.Generic;

namespace IQIGame.Onigao.GamePlay.GamePlay.Runtime.Util
{
    /// <summary>
    /// Entity访问工具
    /// </summary>
    public static class GameAreaAccessUtil
    {
        public static IGameAreaAccessor curAreaAccessor
        {
            get
            {
                if (_accessors.TryGetValue(GameDataCenter.CurrGameArea, out var ret)) return ret;
                LogGame.LogError($"No EntityAccessor for {GameDataCenter.CurrGameArea} entity");
                return null;
            }
        }

        private static readonly Dictionary<GameplayAreaType, IGameAreaAccessor> _accessors = new()
        {
            {GameplayAreaType.MainCity, new MainCityGameAreaAccessor()},
            {GameplayAreaType.Level, new LevelGameAreaAccessor()},
        };
    }
}